<template>
	<view class="content">
		<image class="image" src="https://sslc-oss.oss-cn-chengdu.aliyuncs.com/erp/static/bg.png" mode="aspectFit"
			@longpress="handleLongPress" />
		<text class="tip" >长按图片保存</text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showTip: false,
			};
		},
		methods: {
			handleLongPress() {
				this.showTip = true;
				// 设置一个定时器来隐藏提示，例如2秒后
				setTimeout(() => {
					this.showTip = false;
				}, 2000);
				// 这里不能直接保存图片到相册，只能提示用户如何操作
				uni.showToast({
					title: '请长按图片保存到相册',
					icon: 'none'
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 100vh;
	}

	.image {
		width: 300px;
		height: 300px;
		margin-bottom: 20px;
	}

	.tip {
		color: #999;
		font-size: 14px;
		text-align: center;
	}
</style>